In this analysis I used real data from Brazil Stock Market.
I will create a R package called r-stock-analysis https://github.com/caiomsouza/r-stock-analysis
http://www.thertrader.com/2014/02/28/using-cart-for-stock-market-forecasting/
https://cran.r-project.org/web/packages/stocks/index.html
https://www.youtube.com/watch?v=iMET2gbsbHY
http://www.r-chart.com/2010/06/stock-analysis-using-r.html
En esta tarea se trata de que apliquéis los métodos mostrados en clase para cuantificar el riesgo de mercado de los activos financieros.
1- Selección de variables: debeis seleccionar 5 valores (acciones) del mercado continuo español más el ibex 35 y bajar la serie completa. Para el punto 2 y 3 se utilizarán las series temporales completas hasta el 30 de septiembre de 2015. el mes de octubre se reservará para hacer predicciones
2.- ¿Son los mercados de estos 6 valores eficientes?
3.- ¿Se puede modelizar la serie de rendimientos diarios de estos valores?. ¿Que modelo predice mejor (utiliazando el error cuadrático medio)?
4.- Utilizando información de los dos últimos años. ¿cual es la mejor cartera que se puede formar con esos 5 valores?. Suponga para ello dos posibilidades, que los agentes son aversos al riesgos y no tienen otras alternativas de inversión (es deseable la cartera de menor riesgo); y en segundo lugar que existe la posibilidad de invertir (o endeudarse) a un tipo de interés sin riesgo del 0.5%. ¿Cómo se comportan estas carteras durante el mes de octubre mejor o peor que el ibex?. ¿Cual es la beta de los 5 valores? ¿y la beta de la cartera?, ¿cual de los cinco valores ha tenido un comportamiento mejor que lo esperado según la teorÃa del CAPM?
Por favor entregue un archivo word o pdf con los resultados principales de su trabajo explicando qué es lo que obtiene y que se deriva de dichos resultados. Puede incluir en el código R en el texto principal o al final del texto en un anexo, se valorará positivamente.
# UCM
# Prof. Lorenzo Escot
# Alumno: Caio Fernandes Moreno (caiofern@ucm.es)
# Brazil Stock Market Analysis
setwd("~/git/Bitbucket/ucm/SCORE/tareas/Lorenzo-Escot")
library(tseries) # adf.test, kpss.test, bds.test, get.hist.quote, portfolio.optim, surrogate, arma, garch
#install.packages("forecast")
library(forecast)
## Loading required package: zoo
##
## Attaching package: 'zoo'
##
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Loading required package: timeDate
## This is forecast 6.2
# En el paquete forecast tiene un modelo auto ARIMA.
#install.packages("fArma")
library(fArma) #ARMAFIT, RSFIT
## Loading required package: timeSeries
##
## Attaching package: 'timeSeries'
##
## The following object is masked from 'package:zoo':
##
## time<-
##
## Loading required package: fBasics
##
##
## Rmetrics Package fBasics
## Analysing Markets and calculating Basic Statistics
## Copyright (C) 2005-2014 Rmetrics Association Zurich
## Educational Software for Financial Engineering and Computational Science
## Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
## https://www.rmetrics.org --- Mail to: info@rmetrics.org
#install.packages("fGarch")
library(fGarch) #GARCHFIT formula ~arma (2,1) + garch (1,1) # ~ AltGr + 4
#install.packages("outliers")
library(outliers) #: outlier, rm.outlier, scores, chisq.out.test # para detectar outliers o datos an?malos ojo serie estacionaria
##
## Attaching package: 'outliers'
##
## The following object is masked from 'package:timeSeries':
##
## outlier
#install.packages("zoo")
library(zoo)
#setinternet2() #esto abre el puerto de internet
#stock.name <- "^BVSP"
#stock.description <- "IBOVESPA"
generateAnalysis <- function(x, y) {
stock.name <- x
stock.description <- y
## lectura de los datos hist?ricos del ^BVSP
stock.name <- get.hist.quote(instrument=stock.name, quote="AdjClose")
# BVSP time series starts 1993-04-27
# http://finance.yahoo.com/q?s=%5EBVSP
series.name <- stock.name
str(series.name)
summary(series.name)
start(series.name)
end(series.name)
plot(series.name)
head(series.name, 10)
tail(series.name, 10)
# Mirando los datos he decidido con la ayuda del Prof. Lorenzo no quitar los datos de 1993 hasta 1998.
#?existen datos nulos?
length(series.name)
length(series.name[!is.na(series.name)])
length(complete.cases(series.name))
#parece que no, pero si tuviera na se podr?an quitar con: ibex<-ibex[complete.cases(ibex)]
series.name<-series.name[complete.cases(series.name)]
plot(series.name)
### podemos seleccionar una submuestra: Temporal
series.name.short <-window(series.name,start=as.Date("1993-04-27"),end=as.Date("2015-09-30"))
str(series.name.short)
summary(series.name.short)
plot(series.name.short)
## Calculo la serie de rendimientos
d.series.name <- diff(log(series.name.short))
# Concatenate stock.description with the text Withall
plot.description <- paste(stock.description, "WITH ALL DATA", collapse = ", ")
#Grafico de la serie
plot(d.series.name, main=(plot.description))
#Datos an?malos
# type = z Busca los datos tipificados mayor que 5 vezes la sd (disviacion tipica)
# Remove datos anomalos
remove.outlier.d.series.name <- d.series.name[abs(scores(d.series.name, type="z"))<=5]
#plot(remove.outlier.d.series.name, main="IBOVESPA WITHOUT OUTLIERS")
# Concatenate stock.description with the text Withall
plot.description <- paste(stock.description, " WITHOUT OUTLIERS", collapse = ", ")
#Grafico de la serie
plot(d.series.name, main=(plot.description))
#?es estacionario?
adf.test(d.series.name)# Ho: una ra?z unitaria (no estacionaria)
# Augmented Dickey-Fuller Test
# data: dBVSP
# Dickey-Fuller = -14.073, Lag order = 17, p-value = 0.01
# alternative hypothesis: stationary
# No es estacionaria
sd(d.series.name) #desviaci?n t?pica
# Statistical stationarity:
# http://people.duke.edu/~rnau/411diff.htm
#?presenta correlaci?n?
df.d.series.name <- as.data.frame(d.series.name)
#periodograma
par(mfrow=c(2,1))
acf(df.d.series.name, ylim=c(-1,1))
pacf(df.d.series.name, ylim=c(-1,1))
tsdisplay(df.d.series.name)
# test bds
bds.test(d.series.name,m=10) # H0: i.i.d
#test R/, exponente de Hurst
HURST<-rsFit(d.series.name, doplot = T)# Exponente de Hurst 0.5 ruido blanco
HURST
##Se puede hacer el test de Hurst=0.5 con el siguiente estad?stico t ##
t<-(HURST@hurst$diag[2,1]-0.5)/HURST@hurst$diag[2,2]
t
#Modelo Auto Arima
modelo.auto.arima <- auto.arima(d.series.name)
plot(forecast(modelo.auto.arima,h=20))
modelo.auto.arima1 <- auto.arima(d.series.name)
plot(forecast(modelo.auto.arima1, h=1))
# alternativa
d.series.name.ARMA<-armaFit(~ arma(1,3), data=d.series.name)
summary(d.series.name.ARMA, wich="all")
residuo<-residuals(d.series.name.ARMA)
plot(residuo)
lines(residuo)
df.residuo <- as.data.frame(residuo)
#periodograma
par(mfrow=c(2,1))
acf(df.residuo, ylim=c(-1,1))
pacf(df.residuo, ylim=c(-1,1))
#x11()
tsdisplay(df.residuo)
# test bds
bds.test(d.series.name,m=10) # H0: i.i.d
#test R/, exponente de Hurst
HURST<-rsFit(d.series.name, doplot = T)# Exponente de Hurst 0.5 ruido blanco
HURST
# Este codigo ha tenido muchas modificaciones hay que cojer el codigo del profesor Lorenzo.
##Se puede hacer el test de Hurst=0.5 con el siguiente estad?stico t ##
t<-(HURST@hurst$diag[2,1]-0.5)/HURST@hurst$diag[2,2]
t
####PREDICCIONES
predict(d.series.name.ARMA, n.ahead=10, conf=c(90,95), dplot=True)
#alternativo
d.series.name.ARMAGARCH<-garchFit(~ arma(1,1) + garch(2,1), data=d.series.name, include.mean=TRUE) ####aqu? el orden es GARCH,ARCH
summary(d.series.name.ARMAGARCH)
plot(d.series.name.ARMAGARCH@residuals)
residuogarch<-residuals(d.series.name.ARMAGARCH)
volatilitygarch<-volatility(d.series.name.ARMAGARCH)
plot(volatilitygarch)
lines(volatilitygarch)
plot(d.series.name^2)
predict(d.series.name.ARMAGARCH, n.ahead=10, conf=c(90,95), dplot=TRUE)
}
# IBOVESPA
stock.name <- "^BVSP"
stock.description <- "IBOVESPA"
# Call your function and pass x and y to the function
run <- generateAnalysis(stock.name,stock.description)
## time series starts 1993-04-27
## 'zoo' series from 1993-04-27 to 2016-01-06
## Data: num [1:5635, 1] 24.5 24.3 23.7 24.1 24.1 ...
## - attr(*, "dimnames")=List of 2
## ..$ : NULL
## ..$ : chr "AdjClose"
## Index: Date[1:5635], format: "1993-04-27" "1993-04-28" "1993-04-29" "1993-04-30" ...
## 'zoo' series from 1993-04-27 to 2015-09-30
## Data: num [1:5572] 24.5 24.3 23.7 24.1 24.1 ...
## Index: Date[1:5572], format: "1993-04-27" "1993-04-28" "1993-04-29" "1993-04-30" ...
## Warning in adf.test(d.series.name): p-value smaller than printed p-value
## Warning in sqrt(diag(fit$var.coef)): NaNs produced
##
## Title:
## ARIMA Modelling
##
## Call:
## armaFit(formula = ~arma(1, 3), data = d.series.name)
##
## Model:
## ARIMA(1,0,3) with method: CSS-ML
##
## Coefficient(s):
## ar1 ma1 ma2 ma3 intercept
## 0.028451 0.027562 -0.006066 -0.012289 0.001349
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.1724656 -0.0116332 -0.0002197 0.0116098 0.2916280
##
## Moments:
## Skewness Kurtosis
## 0.5518 10.4767
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## ar1 0.0284509 NA NA NA
## ma1 0.0275620 NA NA NA
## ma2 -0.0060665 NA NA NA
## ma3 -0.0122894 0.0034857 -3.526 0.000422 ***
## intercept 0.0013495 0.0003251 4.151 3.31e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## sigma^2 estimated as: 0.0005446
## log likelihood: 13029.24
## AIC Criterion: -26046.48
##
## Description:
## Thu Jan 7 16:12:14 2016 by user:
##
## Series Initialization:
## ARMA Model: arma
## Formula Mean: ~ arma(1, 1)
## GARCH Model: garch
## Formula Variance: ~ garch(2, 1)
## ARMA Order: 1 1
## Max ARMA Order: 1
## GARCH Order: 2 1
## Max GARCH Order: 2
## Maximum Order: 2
## Conditional Dist: norm
## h.start: 3
## llh.start: 1
## Length of Series: 5571
## Recursion Init: mci
## Series Scale: 0.02337828
##
## Parameter Initialization:
## Initial Parameters: $params
## Limits of Transformations: $U, $V
## Which Parameters are Fixed? $includes
## Parameter Matrix:
## U V params includes
## mu -0.57716768 0.5771677 0.05772286 TRUE
## ar1 -0.99999999 1.0000000 -0.04584008 TRUE
## ma1 -0.99999999 1.0000000 0.10215077 TRUE
## omega 0.00000100 100.0000000 0.10000000 TRUE
## alpha1 0.00000001 1.0000000 0.05000000 TRUE
## alpha2 0.00000001 1.0000000 0.05000000 TRUE
## gamma1 -0.99999999 1.0000000 0.10000000 FALSE
## gamma2 -0.99999999 1.0000000 0.10000000 FALSE
## beta1 0.00000001 1.0000000 0.80000000 TRUE
## delta 0.00000000 2.0000000 2.00000000 FALSE
## skew 0.10000000 10.0000000 1.00000000 FALSE
## shape 1.00000000 10.0000000 4.00000000 FALSE
## Index List of Parameters to be Optimized:
## mu ar1 ma1 omega alpha1 alpha2 beta1
## 1 2 3 4 5 6 9
## Persistence: 0.9
##
##
## --- START OF TRACE ---
## Selected Algorithm: nlminb
##
## R coded nlminb Solver:
##
## 0: 7007.5070: 0.0577229 -0.0458401 0.102151 0.100000 0.0500000 0.0500000 0.800000
## 1: 6912.5211: 0.0577222 -0.0462831 0.101731 0.0745310 0.0495072 0.0487042 0.786314
## 2: 6853.3005: 0.0577207 -0.0470350 0.101025 0.0634282 0.0685389 0.0667259 0.791504
## 3: 6836.3228: 0.0577203 -0.0472069 0.100865 0.0568509 0.0683983 0.0664953 0.789530
## 4: 6820.2471: 0.0577188 -0.0477502 0.100360 0.0438816 0.0716566 0.0695678 0.788959
## 5: 6812.6945: 0.0577096 -0.0502291 0.0980834 0.0378664 0.0817180 0.0812599 0.810664
## 6: 6805.5983: 0.0576893 -0.0540431 0.0946779 0.0164254 0.0748376 0.0771232 0.825021
## 7: 6794.9712: 0.0575556 -0.0718150 0.0795594 0.0237874 0.0753770 0.0716922 0.836102
## 8: 6788.5061: 0.0574791 -0.0557498 0.0969688 0.0199860 0.0745192 0.0629286 0.846183
## 9: 6787.9674: 0.0574787 -0.0557881 0.0969381 0.0190952 0.0740933 0.0624548 0.845810
## 10: 6787.5205: 0.0574688 -0.0566813 0.0962259 0.0199000 0.0719904 0.0593221 0.848100
## 11: 6787.4584: 0.0574596 -0.0573165 0.0957600 0.0170137 0.0729269 0.0590613 0.851498
## 12: 6786.9905: 0.0574435 -0.0578171 0.0955500 0.0178711 0.0729353 0.0566919 0.855337
## 13: 6786.3007: 0.0574238 -0.0583268 0.0953934 0.0166574 0.0727417 0.0533564 0.858240
## 14: 6785.0358: 0.0573042 -0.0609257 0.0949264 0.0147055 0.0756105 0.0374833 0.873206
## 15: 6784.9513: 0.0573039 -0.0609300 0.0949275 0.0144428 0.0754729 0.0373121 0.873049
## 16: 6784.9178: 0.0573005 -0.0609769 0.0949412 0.0148881 0.0752191 0.0367046 0.872989
## 17: 6784.8955: 0.0572891 -0.0610873 0.0950334 0.0148109 0.0757447 0.0361657 0.872897
## 18: 6784.8194: 0.0572043 -0.0618735 0.0957554 0.0150197 0.0791459 0.0331976 0.872542
## 19: 6784.8080: 0.0569791 -0.0636508 0.0980053 0.0146289 0.0789961 0.0327952 0.872790
## 20: 6784.7182: 0.0567522 -0.0654953 0.100181 0.0148012 0.0789341 0.0327467 0.873255
## 21: 6784.2295: 0.0518477 -0.109835 0.139305 0.0136174 0.0757387 0.0313714 0.878754
## 22: 6784.1406: 0.0511277 -0.113360 0.147435 0.0135018 0.0758185 0.0301757 0.880208
## 23: 6784.0039: 0.0503543 -0.116973 0.149390 0.0138244 0.0803689 0.0257012 0.879560
## 24: 6784.0031: 0.0503540 -0.116965 0.149401 0.0137353 0.0804061 0.0256993 0.879575
## 25: 6784.0014: 0.0503509 -0.116926 0.149379 0.0137706 0.0804440 0.0256933 0.879620
## 26: 6784.0006: 0.0503467 -0.116889 0.149364 0.0137362 0.0804623 0.0256583 0.879637
## 27: 6783.9995: 0.0503375 -0.116818 0.149332 0.0137450 0.0805052 0.0256090 0.879689
## 28: 6783.9886: 0.0501455 -0.115640 0.148781 0.0136994 0.0808562 0.0245808 0.880245
## 29: 6783.9846: 0.0500002 -0.113680 0.146786 0.0136566 0.0810501 0.0244768 0.880418
## 30: 6783.9807: 0.0498245 -0.112089 0.145224 0.0135753 0.0811067 0.0244143 0.880404
## 31: 6783.9734: 0.0488638 -0.107401 0.141045 0.0136648 0.0811885 0.0248538 0.879887
## 32: 6783.9621: 0.0482468 -0.0977786 0.130713 0.0134019 0.0819212 0.0235134 0.880859
## 33: 6783.9523: 0.0474507 -0.105218 0.138210 0.0134022 0.0835961 0.0203012 0.882299
## 34: 6783.9500: 0.0474507 -0.105220 0.138209 0.0132982 0.0835712 0.0202772 0.882257
## 35: 6783.9484: 0.0474539 -0.105285 0.138273 0.0133313 0.0835901 0.0203023 0.882275
## 36: 6783.9481: 0.0474599 -0.105422 0.138394 0.0132626 0.0836327 0.0203670 0.882278
## 37: 6783.9477: 0.0474707 -0.105728 0.138694 0.0132844 0.0836298 0.0204006 0.882266
## 38: 6783.9464: 0.0475954 -0.110869 0.143667 0.0133533 0.0833928 0.0209793 0.881851
## 39: 6783.9463: 0.0474949 -0.108712 0.141564 0.0133731 0.0831606 0.0213533 0.881696
## 40: 6783.9463: 0.0477035 -0.113348 0.146237 0.0133731 0.0832319 0.0212893 0.881691
## 41: 6783.9463: 0.0475918 -0.111389 0.144202 0.0133688 0.0832613 0.0212018 0.881746
## 42: 6783.9463: 0.0475979 -0.111229 0.144069 0.0133695 0.0832390 0.0212428 0.881729
## 43: 6783.9463: 0.0476014 -0.111364 0.144201 0.0133697 0.0832420 0.0212388 0.881730
##
## Final Estimate of the Negative LLH:
## LLH: -14140.44 norm LLH: -2.538223
## mu ar1 ma1 omega alpha1
## 1.112838e-03 -1.113636e-01 1.442007e-01 7.307105e-06 8.324200e-02
## alpha2 beta1
## 2.123883e-02 8.817298e-01
##
## R-optimhess Difference Approximated Hessian Matrix:
## mu ar1 ma1 omega alpha1
## mu -1.549541e+07 -10973.6813 4394.0775 1.001200e+08 8.825238e+03
## ar1 -1.097368e+04 -5220.4525 -5213.6790 2.855247e+05 1.579227e+02
## ma1 4.394078e+03 -5213.6790 -5232.8327 2.416058e+05 1.471186e+02
## omega 1.001200e+08 285524.6926 241605.8057 -3.215057e+12 -5.470996e+08
## alpha1 8.825238e+03 157.9227 147.1186 -5.470996e+08 -1.621422e+05
## alpha2 9.952543e+02 199.6427 198.0982 -5.611563e+08 -1.616199e+05
## beta1 -1.252181e+04 -309.0611 -291.8503 -7.660070e+08 -1.853151e+05
## alpha2 beta1
## mu 9.952543e+02 -1.252181e+04
## ar1 1.996427e+02 -3.090611e+02
## ma1 1.980982e+02 -2.918503e+02
## omega -5.611563e+08 -7.660070e+08
## alpha1 -1.616199e+05 -1.853151e+05
## alpha2 -1.659141e+05 -1.908219e+05
## beta1 -1.908219e+05 -2.369930e+05
## attr(,"time")
## Time difference of 0.213238 secs
##
## --- END OF TRACE ---
##
##
## Time to Estimate Parameters:
## Time difference of 0.802696 secs
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(2, 1), data = d.series.name,
## include.mean = TRUE)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(2, 1)
## <environment: 0x7fd1bdddbaa0>
## [data = d.series.name]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 1.1128e-03 -1.1136e-01 1.4420e-01 7.3071e-06 8.3242e-02
## alpha2 beta1
## 2.1239e-02 8.8173e-01
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.113e-03 3.965e-04 2.807 0.005 **
## ar1 -1.114e-01 3.066e-01 -0.363 0.716
## ma1 1.442e-01 3.060e-01 0.471 0.637
## omega 7.307e-06 1.445e-06 5.056 4.29e-07 ***
## alpha1 8.324e-02 1.467e-02 5.673 1.41e-08 ***
## alpha2 2.124e-02 1.906e-02 1.114 0.265
## beta1 8.817e-01 1.257e-02 70.121 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 14140.44 normalized: 2.538223
##
## Description:
## Thu Jan 7 16:12:16 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 383.587 0
## Shapiro-Wilk Test R W NA NA
## Ljung-Box Test R Q(10) 22.13172 0.01444747
## Ljung-Box Test R Q(15) 34.83257 0.002597619
## Ljung-Box Test R Q(20) 49.09035 0.0002985119
## Ljung-Box Test R^2 Q(10) 21.52159 0.0177362
## Ljung-Box Test R^2 Q(15) 24.39986 0.05860695
## Ljung-Box Test R^2 Q(20) 36.64023 0.01291958
## LM Arch Test R TR^2 23.01995 0.02755703
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -5.073933 -5.065608 -5.073936 -5.071031
# Itau
stock.name <- "ITSA4.SA"
stock.description <- "Itausa - Investimentos Itau S.A"
# Call your function and pass x and y to the function
run <- generateAnalysis(stock.name,stock.description)
## time series starts 2000-01-03
## 'zoo' series from 2000-01-03 to 2016-01-06
## Data: num [1:3989, 1] 1.14 1.03 1.12 1.13 1.13 ...
## - attr(*, "dimnames")=List of 2
## ..$ : NULL
## ..$ : chr "AdjClose"
## Index: Date[1:3989], format: "2000-01-03" "2000-01-04" "2000-01-05" "2000-01-06" ...
## 'zoo' series from 2000-01-03 to 2015-09-30
## Data: num [1:3919] 1.14 1.03 1.12 1.13 1.13 ...
## Index: Date[1:3919], format: "2000-01-03" "2000-01-04" "2000-01-05" "2000-01-06" ...
## Warning in adf.test(d.series.name): p-value smaller than printed p-value
## Warning in sqrt(diag(fit$var.coef)): NaNs produced
##
## Title:
## ARIMA Modelling
##
## Call:
## armaFit(formula = ~arma(1, 3), data = d.series.name)
##
## Model:
## ARIMA(1,0,3) with method: CSS-ML
##
## Coefficient(s):
## ar1 ma1 ma2 ma3 intercept
## -0.4622035 0.4578396 -0.0348802 -0.0624000 0.0004784
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.1513910 -0.0126070 -0.0004014 0.0120342 0.2207431
##
## Moments:
## Skewness Kurtosis
## 0.1585 5.8397
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## ar1 -0.4622035 NA NA NA
## ma1 0.4578396 NA NA NA
## ma2 -0.0348802 0.0180969 -1.927 0.053928 .
## ma3 -0.0624000 0.0160788 -3.881 0.000104 ***
## intercept 0.0004784 0.0003490 1.371 0.170464
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## sigma^2 estimated as: 0.00055
## log likelihood: 9144.02
## AIC Criterion: -18276.04
##
## Description:
## Thu Jan 7 16:12:23 2016 by user:
##
## Series Initialization:
## ARMA Model: arma
## Formula Mean: ~ arma(1, 1)
## GARCH Model: garch
## Formula Variance: ~ garch(2, 1)
## ARMA Order: 1 1
## Max ARMA Order: 1
## GARCH Order: 2 1
## Max GARCH Order: 2
## Maximum Order: 2
## Conditional Dist: norm
## h.start: 3
## llh.start: 1
## Length of Series: 3918
## Recursion Init: mci
## Series Scale: 0.02349959
## Warning in arima(.series$x, order = c(u, 0, v), include.mean =
## include.mean): possible convergence problem: optim gave code = 1
## Parameter Initialization:
## Initial Parameters: $params
## Limits of Transformations: $U, $V
## Which Parameters are Fixed? $includes
## Parameter Matrix:
## U V params includes
## mu -0.19735249 0.1973525 0.02116543 TRUE
## ar1 -0.99999999 1.0000000 -0.55064704 TRUE
## ma1 -0.99999999 1.0000000 0.54580383 TRUE
## omega 0.00000100 100.0000000 0.10000000 TRUE
## alpha1 0.00000001 1.0000000 0.05000000 TRUE
## alpha2 0.00000001 1.0000000 0.05000000 TRUE
## gamma1 -0.99999999 1.0000000 0.10000000 FALSE
## gamma2 -0.99999999 1.0000000 0.10000000 FALSE
## beta1 0.00000001 1.0000000 0.80000000 TRUE
## delta 0.00000000 2.0000000 2.00000000 FALSE
## skew 0.10000000 10.0000000 1.00000000 FALSE
## shape 1.00000000 10.0000000 4.00000000 FALSE
## Index List of Parameters to be Optimized:
## mu ar1 ma1 omega alpha1 alpha2 beta1
## 1 2 3 4 5 6 9
## Persistence: 0.9
##
##
## --- START OF TRACE ---
## Selected Algorithm: nlminb
##
## R coded nlminb Solver:
##
## 0: 5242.2289: 0.0211654 -0.550647 0.545804 0.100000 0.0500000 0.0500000 0.800000
## 1: 5237.9398: 0.0211656 -0.550584 0.545775 0.0939968 0.0490868 0.0485212 0.796818
## 2: 5234.0814: 0.0211666 -0.550259 0.545674 0.0863456 0.0586183 0.0554934 0.799969
## 3: 5232.4526: 0.0211668 -0.550164 0.545682 0.0827873 0.0576379 0.0541377 0.798412
## 4: 5231.1120: 0.0211684 -0.549485 0.545760 0.0768023 0.0632714 0.0571542 0.803834
## 5: 5228.4869: 0.0211732 -0.547391 0.546017 0.0634602 0.0616730 0.0493813 0.817273
## 6: 5224.4317: 0.0211792 -0.546533 0.544587 0.0575780 0.0627765 0.0425538 0.835734
## 7: 5215.2208: 0.0212023 -0.551108 0.531163 0.0259704 0.0622625 0.00725046 0.901836
## 8: 5214.9234: 0.0212023 -0.551028 0.531228 0.0265262 0.0625851 0.00748926 0.902286
## 9: 5214.8008: 0.0212028 -0.550154 0.531939 0.0265851 0.0622761 0.00620402 0.902614
## 10: 5214.5388: 0.0212107 -0.546809 0.532779 0.0270990 0.0624737 0.00640765 0.902971
## 11: 5214.4154: 0.0212189 -0.543425 0.533580 0.0268713 0.0621906 0.00616550 0.902723
## 12: 5214.4069: 0.0212276 -0.540025 0.534245 0.0273328 0.0623636 0.00639938 0.902906
## 13: 5214.3535: 0.0212336 -0.538571 0.533713 0.0272686 0.0625448 0.00584667 0.902361
## 14: 5214.3057: 0.0212329 -0.539762 0.532631 0.0274683 0.0631157 0.00542864 0.902354
## 15: 5214.2823: 0.0212456 -0.537773 0.530303 0.0272307 0.0640549 0.00411904 0.902070
## 16: 5214.1604: 0.0212585 -0.534537 0.529278 0.0276119 0.0646694 0.00389914 0.902135
## 17: 5214.1006: 0.0212858 -0.528582 0.526218 0.0264993 0.0649148 0.00298597 0.903237
## 18: 5214.0354: 0.0213236 -0.528870 0.513870 0.0244897 0.0613136 0.00410330 0.908325
## 19: 5214.0085: 0.0213237 -0.528819 0.513907 0.0246519 0.0614323 0.00412083 0.908466
## 20: 5213.9899: 0.0213238 -0.528713 0.513986 0.0246078 0.0614356 0.00390835 0.908465
## 21: 5213.9696: 0.0213255 -0.528374 0.513781 0.0247883 0.0616028 0.00377062 0.908581
## 22: 5213.9422: 0.0213298 -0.527716 0.513123 0.0247787 0.0616677 0.00346540 0.908431
## 23: 5213.9081: 0.0213387 -0.526378 0.511765 0.0250607 0.0620297 0.00317671 0.908370
## 24: 5213.8574: 0.0213573 -0.523642 0.508996 0.0251212 0.0624005 0.00278153 0.907931
## 25: 5213.6207: 0.0215468 -0.495338 0.484540 0.0244704 0.0635385 0.00417500 0.906968
## 26: 5213.4552: 0.0217446 -0.468101 0.459081 0.0254614 0.0623108 0.00246697 0.906866
## 27: 5213.4479: 0.0219552 -0.442049 0.432787 0.0276590 0.0645128 0.00152952 0.905667
## 28: 5213.1813: 0.0220374 -0.437776 0.427382 0.0277873 0.0661175 0.000118229 0.903692
## 29: 5213.1167: 0.0221486 -0.434467 0.426867 0.0264039 0.0625110 0.00208115 0.907099
## 30: 5213.0916: 0.0221487 -0.434445 0.426880 0.0260543 0.0626483 0.00197831 0.907099
## 31: 5213.0692: 0.0221534 -0.434381 0.426818 0.0261019 0.0628864 0.00203949 0.907252
## 32: 5213.0483: 0.0221653 -0.434100 0.426532 0.0258801 0.0630060 0.00189263 0.907192
## 33: 5213.0248: 0.0221881 -0.433403 0.425819 0.0259048 0.0633145 0.00185943 0.907282
## 34: 5212.9961: 0.0222300 -0.431813 0.424211 0.0257431 0.0635391 0.00162834 0.907165
## 35: 5212.9575: 0.0223075 -0.428398 0.420799 0.0258311 0.0639807 0.00144657 0.907152
## 36: 5212.8054: 0.0232118 -0.394487 0.387162 0.0261158 0.0654414 1.00000e-08 0.906061
## 37: 5212.5833: 0.0257159 -0.422872 0.412330 0.0248318 0.0674655 1.00000e-08 0.906331
## 38: 5212.5678: 0.0257159 -0.422846 0.412353 0.0249798 0.0675083 1.00000e-08 0.906457
## 39: 5212.5558: 0.0257163 -0.422627 0.412545 0.0249481 0.0670954 1.00000e-08 0.906549
## 40: 5212.5439: 0.0257363 -0.422570 0.412535 0.0250631 0.0671285 1.00000e-08 0.906673
## 41: 5212.5356: 0.0257766 -0.422421 0.412537 0.0249879 0.0669704 1.00000e-08 0.906720
## 42: 5212.5232: 0.0258577 -0.422252 0.412417 0.0250455 0.0669515 1.00000e-08 0.906842
## 43: 5211.5509: 0.0445587 -0.388189 0.377516 0.0224797 0.0597943 1.00000e-08 0.915669
## 44: 5211.2496: 0.0516639 -0.377569 0.375124 0.0244132 0.0634322 1.00000e-08 0.910325
## 45: 5211.1828: 0.0574399 -0.447700 0.442259 0.0234704 0.0650098 1.00000e-08 0.910459
## 46: 5211.1390: 0.0582842 -0.423568 0.415022 0.0235889 0.0658549 1.00000e-08 0.909636
## 47: 5211.1121: 0.0572153 -0.412415 0.405121 0.0238046 0.0654789 1.00000e-08 0.909554
## 48: 5211.1087: 0.0565741 -0.406631 0.399915 0.0238993 0.0652300 1.00000e-08 0.909608
## 49: 5211.1087: 0.0565897 -0.406560 0.399838 0.0239019 0.0652405 1.00000e-08 0.909592
## 50: 5211.1087: 0.0565884 -0.406549 0.399826 0.0239017 0.0652404 1.00000e-08 0.909593
##
## Final Estimate of the Negative LLH:
## LLH: -9484.418 norm LLH: -2.420729
## mu ar1 ma1 omega alpha1
## 1.329805e-03 -4.065493e-01 3.998263e-01 1.319924e-05 6.524036e-02
## alpha2 beta1
## 1.000000e-08 9.095929e-01
##
## R-optimhess Difference Approximated Hessian Matrix:
## mu ar1 ma1 omega
## mu -5024279.809 -3118.73091 1471.74511 -6.502179e+07
## ar1 -3118.731 -4103.35508 -4052.80869 -3.332937e+05
## ma1 1471.745 -4052.80869 -4075.27825 -2.683192e+05
## omega -65021785.290 -333293.72547 -268319.17123 -1.540547e+12
## alpha1 -2086.051 237.30353 248.60591 -4.750227e+08
## alpha2 -4629.759 23.75007 30.52669 -4.797590e+08
## beta1 -24801.877 -465.62881 -438.75675 -6.097617e+08
## alpha1 alpha2 beta1
## mu -2.086051e+03 -4.629759e+03 -2.480188e+04
## ar1 2.373035e+02 2.375007e+01 -4.656288e+02
## ma1 2.486059e+02 3.052669e+01 -4.387568e+02
## omega -4.750227e+08 -4.797590e+08 -6.097617e+08
## alpha1 -2.035722e+05 -2.024629e+05 -2.224960e+05
## alpha2 -2.024629e+05 -2.062615e+05 -2.265880e+05
## beta1 -2.224960e+05 -2.265880e+05 -2.702168e+05
## attr(,"time")
## Time difference of 0.1453691 secs
##
## --- END OF TRACE ---
##
##
## Time to Estimate Parameters:
## Time difference of 0.6953762 secs
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(2, 1), data = d.series.name,
## include.mean = TRUE)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(2, 1)
## <environment: 0x7fd1b9071f08>
## [data = d.series.name]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 1.3298e-03 -4.0655e-01 3.9983e-01 1.3199e-05 6.5240e-02
## alpha2 beta1
## 1.0000e-08 9.0959e-01
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.330e-03 4.606e-04 2.887 0.003885 **
## ar1 -4.065e-01 1.206e-01 -3.370 0.000752 ***
## ma1 3.998e-01 1.210e-01 3.303 0.000956 ***
## omega 1.320e-05 3.164e-06 4.171 3.03e-05 ***
## alpha1 6.524e-02 1.460e-02 4.468 7.88e-06 ***
## alpha2 1.000e-08 1.823e-02 0.000 1.000000
## beta1 9.096e-01 1.411e-02 64.487 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 9484.418 normalized: 2.420729
##
## Description:
## Thu Jan 7 16:12:25 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 972.8185 0
## Shapiro-Wilk Test R W 0.9809267 0
## Ljung-Box Test R Q(10) 18.93227 0.04113149
## Ljung-Box Test R Q(15) 22.2451 0.1015363
## Ljung-Box Test R Q(20) 26.26359 0.1572818
## Ljung-Box Test R^2 Q(10) 8.41126 0.5887326
## Ljung-Box Test R^2 Q(15) 11.84018 0.6910838
## Ljung-Box Test R^2 Q(20) 13.71289 0.8447494
## LM Arch Test R TR^2 10.65483 0.5587085
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -4.837886 -4.826677 -4.837892 -4.833908
# BBAS3.SA
stock.name <- "BBAS3.SA"
stock.description <- "Banco do Brasil S.A."
# Call your function and pass x and y to the function
run <- generateAnalysis(stock.name,stock.description)
## time series starts 2000-01-03
## 'zoo' series from 2000-01-03 to 2016-01-06
## Data: num [1:4134, 1] 1.86 1.78 1.79 1.82 1.78 ...
## - attr(*, "dimnames")=List of 2
## ..$ : NULL
## ..$ : chr "AdjClose"
## Index: Date[1:4134], format: "2000-01-03" "2000-01-04" "2000-01-05" "2000-01-06" ...
## 'zoo' series from 2000-01-03 to 2015-09-30
## Data: num [1:4064] 1.86 1.78 1.79 1.82 1.78 ...
## Index: Date[1:4064], format: "2000-01-03" "2000-01-04" "2000-01-05" "2000-01-06" ...
## Warning in adf.test(d.series.name): p-value smaller than printed p-value
## Warning in sqrt(diag(fit$var.coef)): NaNs produced
##
## Title:
## ARIMA Modelling
##
## Call:
## armaFit(formula = ~arma(1, 3), data = d.series.name)
##
## Model:
## ARIMA(1,0,3) with method: CSS-ML
##
## Coefficient(s):
## ar1 ma1 ma2 ma3 intercept
## -0.0060656 -0.0058871 -0.0409494 -0.0208757 0.0005117
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.164227 -0.015215 -0.000486 0.014395 0.256153
##
## Moments:
## Skewness Kurtosis
## 0.405 5.096
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## ar1 -0.0060656 NA NA NA
## ma1 -0.0058871 NA NA NA
## ma2 -0.0409494 0.0112843 -3.629 0.000285 ***
## ma3 -0.0208757 NA NA NA
## intercept 0.0005117 0.0003929 1.302 0.192872
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## sigma^2 estimated as: 0.0007293
## log likelihood: 8909.2
## AIC Criterion: -17806.4
##
## Description:
## Thu Jan 7 16:12:32 2016 by user:
##
## Series Initialization:
## ARMA Model: arma
## Formula Mean: ~ arma(1, 1)
## GARCH Model: garch
## Formula Variance: ~ garch(2, 1)
## ARMA Order: 1 1
## Max ARMA Order: 1
## GARCH Order: 2 1
## Max GARCH Order: 2
## Maximum Order: 2
## Conditional Dist: norm
## h.start: 3
## llh.start: 1
## Length of Series: 4063
## Recursion Init: mci
## Series Scale: 0.02703795
##
## Parameter Initialization:
## Initial Parameters: $params
## Limits of Transformations: $U, $V
## Which Parameters are Fixed? $includes
## Parameter Matrix:
## U V params includes
## mu -0.18874661 0.1887466 0.01904071 TRUE
## ar1 -0.99999999 1.0000000 0.80929497 TRUE
## ma1 -0.99999999 1.0000000 -0.83740229 TRUE
## omega 0.00000100 100.0000000 0.10000000 TRUE
## alpha1 0.00000001 1.0000000 0.05000000 TRUE
## alpha2 0.00000001 1.0000000 0.05000000 TRUE
## gamma1 -0.99999999 1.0000000 0.10000000 FALSE
## gamma2 -0.99999999 1.0000000 0.10000000 FALSE
## beta1 0.00000001 1.0000000 0.80000000 TRUE
## delta 0.00000000 2.0000000 2.00000000 FALSE
## skew 0.10000000 10.0000000 1.00000000 FALSE
## shape 1.00000000 10.0000000 4.00000000 FALSE
## Index List of Parameters to be Optimized:
## mu ar1 ma1 omega alpha1 alpha2 beta1
## 1 2 3 4 5 6 9
## Persistence: 0.9
##
##
## --- START OF TRACE ---
## Selected Algorithm: nlminb
##
## R coded nlminb Solver:
##
## 0: 5457.7021: 0.0190407 0.809295 -0.837402 0.100000 0.0500000 0.0500000 0.800000
## 1: 5448.6455: 0.0190333 0.809199 -0.834878 0.0898797 0.0507276 0.0487420 0.794443
## 2: 5442.4595: 0.0190236 0.808766 -0.831926 0.0880050 0.0597887 0.0549643 0.797348
## 3: 5436.5735: 0.0189974 0.806754 -0.824995 0.0676468 0.0673191 0.0555951 0.790851
## 4: 5426.8513: 0.0189407 0.798334 -0.814997 0.0652965 0.0841722 0.0589047 0.800200
## 5: 5420.4644: 0.0188657 0.784193 -0.805863 0.0579554 0.0894687 0.0462582 0.805367
## 6: 5416.9488: 0.0187997 0.778746 -0.791786 0.0567519 0.0924213 0.0337040 0.818015
## 7: 5411.1657: 0.0186981 0.754159 -0.790889 0.0405494 0.0982159 0.0129089 0.848153
## 8: 5409.6293: 0.0186719 0.759843 -0.777127 0.0404720 0.101467 0.00912333 0.853256
## 9: 5409.5664: 0.0186700 0.759460 -0.776985 0.0374766 0.0999155 0.00701396 0.851326
## 10: 5408.4942: 0.0186691 0.759285 -0.776914 0.0388619 0.100879 0.00773575 0.852562
## 11: 5407.4262: 0.0186218 0.751330 -0.772654 0.0326713 0.103274 1.00000e-08 0.861096
## 12: 5406.9004: 0.0185367 0.750639 -0.759479 0.0221562 0.0955143 1.00000e-08 0.887414
## 13: 5405.3621: 0.0183701 0.730910 -0.742211 0.0287930 0.0798802 1.00000e-08 0.889404
## 14: 5404.8361: 0.0183677 0.729857 -0.742672 0.0262364 0.0815154 1.00000e-08 0.889227
## 15: 5404.3376: 0.0183585 0.728159 -0.743030 0.0275763 0.0838154 1.00000e-08 0.888734
## 16: 5403.9274: 0.0183443 0.726283 -0.742894 0.0272582 0.0849910 1.00000e-08 0.886500
## 17: 5403.5756: 0.0183045 0.722359 -0.741023 0.0283237 0.0882731 1.00000e-08 0.883843
## 18: 5403.0839: 0.0182023 0.716253 -0.732228 0.0286535 0.0908636 1.00000e-08 0.879550
## 19: 5402.2631: 0.0179607 0.699365 -0.723518 0.0244125 0.0840242 1.00000e-08 0.891236
## 20: 5402.2469: 0.0179604 0.699353 -0.723432 0.0245137 0.0842343 1.00000e-08 0.891350
## 21: 5402.2338: 0.0179598 0.699333 -0.723308 0.0243106 0.0843181 1.00000e-08 0.891248
## 22: 5402.2118: 0.0179556 0.699125 -0.722936 0.0243911 0.0845517 1.00000e-08 0.891348
## 23: 5401.0713: 0.0173478 0.667337 -0.681638 0.0245180 0.0839128 1.00000e-08 0.891089
## 24: 5401.0639: 0.0168868 0.635310 -0.661188 0.0386075 0.103786 1.00000e-08 0.857628
## 25: 5401.0000: 0.0168865 0.635342 -0.661084 0.0377197 0.103691 1.00000e-08 0.857496
## 26: 5400.9324: 0.0168928 0.635295 -0.660886 0.0377216 0.104160 1.00000e-08 0.858170
## 27: 5400.8528: 0.0169168 0.635010 -0.660382 0.0366528 0.104158 1.00000e-08 0.858633
## 28: 5400.7481: 0.0169731 0.634169 -0.659375 0.0362502 0.104002 1.00000e-08 0.860192
## 29: 5400.1747: 0.0179237 0.617377 -0.642442 0.0295881 0.0896161 1.00000e-08 0.880114
## 30: 5400.0218: 0.0179224 0.617490 -0.642002 0.0277450 0.0913318 1.00000e-08 0.880619
## 31: 5399.9862: 0.0179588 0.616322 -0.640785 0.0279554 0.0914910 1.00000e-08 0.881031
## 32: 5399.6615: 0.0191170 0.575338 -0.599814 0.0262848 0.0898151 1.00000e-08 0.884505
## 33: 5399.3155: 0.0191219 0.501956 -0.523692 0.0296181 0.0948942 1.00000e-08 0.875759
## 34: 5399.1778: 0.0223768 0.444831 -0.465234 0.0284471 0.0932548 1.00000e-08 0.878672
## 35: 5399.1115: 0.0232857 0.380784 -0.396861 0.0244319 0.0872102 1.00000e-08 0.889054
## 36: 5399.0129: 0.0268406 0.316476 -0.331474 0.0261076 0.0898021 1.00000e-08 0.884730
## 37: 5398.9539: 0.0308399 0.223219 -0.234907 0.0266919 0.0908727 1.00000e-08 0.883051
## 38: 5398.8284: 0.0423643 -0.0574740 0.0561819 0.0270880 0.0917394 1.00000e-08 0.881813
## 39: 5398.8228: 0.0438001 -0.0955279 0.0952419 0.0268938 0.0914146 1.00000e-08 0.882334
## 40: 5398.8150: 0.0430796 -0.0902748 0.0886937 0.0262144 0.0901917 1.00000e-08 0.884228
## 41: 5398.8139: 0.0429202 -0.0916798 0.0902033 0.0262305 0.0902800 1.00000e-08 0.884140
## 42: 5398.8123: 0.0421547 -0.0913749 0.0900517 0.0263205 0.0904446 1.00000e-08 0.883888
## 43: 5398.8123: 0.0421367 -0.0915237 0.0901895 0.0263244 0.0904327 1.00000e-08 0.883891
## 44: 5398.8123: 0.0421368 -0.0915425 0.0902024 0.0263260 0.0904336 1.00000e-08 0.883888
##
## Final Estimate of the Negative LLH:
## LLH: -9270.706 norm LLH: -2.281739
## mu ar1 ma1 omega alpha1
## 1.139292e-03 -9.154249e-02 9.020237e-02 1.924567e-05 9.043359e-02
## alpha2 beta1
## 1.000000e-08 8.838878e-01
##
## R-optimhess Difference Approximated Hessian Matrix:
## mu ar1 ma1 omega
## mu -6676604.439 -5272.29968 1637.1636 -6.540905e+07
## ar1 -5272.300 -3621.26368 -3538.6041 -6.970961e+05
## ma1 1637.164 -3538.60409 -3470.5155 -6.281187e+05
## omega -65409048.823 -697096.10169 -628118.6838 -6.133251e+11
## alpha1 -3141.074 139.63518 143.5760 -2.265238e+08
## alpha2 -3999.005 177.92623 182.5247 -2.271179e+08
## beta1 -19422.674 -7.74186 13.3349 -3.055991e+08
## alpha1 alpha2 beta1
## mu -3.141074e+03 -3.999005e+03 -1.942267e+04
## ar1 1.396352e+02 1.779262e+02 -7.741860e+00
## ma1 1.435760e+02 1.825247e+02 1.333490e+01
## omega -2.265238e+08 -2.271179e+08 -3.055991e+08
## alpha1 -1.236337e+05 -1.219342e+05 -1.385106e+05
## alpha2 -1.219342e+05 -1.236885e+05 -1.397871e+05
## beta1 -1.385106e+05 -1.397871e+05 -1.715156e+05
## attr(,"time")
## Time difference of 0.1562271 secs
##
## --- END OF TRACE ---
##
##
## Time to Estimate Parameters:
## Time difference of 0.733258 secs
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(2, 1), data = d.series.name,
## include.mean = TRUE)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(2, 1)
## <environment: 0x7fd1bbc0f5b8>
## [data = d.series.name]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 1.1393e-03 -9.1542e-02 9.0202e-02 1.9246e-05 9.0434e-02
## alpha2 beta1
## 1.0000e-08 8.8389e-01
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 1.139e-03 5.747e-04 1.982 0.0474 *
## ar1 -9.154e-02 4.078e-01 -0.224 0.8224
## ma1 9.020e-02 4.163e-01 0.217 0.8285
## omega 1.925e-05 7.174e-06 2.683 0.0073 **
## alpha1 9.043e-02 1.717e-02 5.266 1.39e-07 ***
## alpha2 1.000e-08 2.491e-02 0.000 1.0000
## beta1 8.839e-01 2.731e-02 32.360 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 9270.706 normalized: 2.281739
##
## Description:
## Thu Jan 7 16:12:34 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 453.9605 0
## Shapiro-Wilk Test R W 0.9879195 0
## Ljung-Box Test R Q(10) 6.359994 0.7841659
## Ljung-Box Test R Q(15) 9.014066 0.8767808
## Ljung-Box Test R Q(20) 11.17128 0.9416592
## Ljung-Box Test R^2 Q(10) 22.02592 0.01497309
## Ljung-Box Test R^2 Q(15) 27.53434 0.02467251
## Ljung-Box Test R^2 Q(20) 33.57461 0.02915051
## LM Arch Test R TR^2 21.8295 0.03947568
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -4.560032 -4.549162 -4.560038 -4.556182
# KROT3.SA
stock.name <- "KROT3.SA"
stock.description <- "Kroton Educacional S.A."
# Call your function and pass x and y to the function
run <- generateAnalysis(stock.name,stock.description)
## time series starts 2012-03-14
## 'zoo' series from 2012-03-14 to 2016-01-06
## Data: num [1:994, 1] 2.21 2.21 2.21 2.21 2.21 ...
## - attr(*, "dimnames")=List of 2
## ..$ : NULL
## ..$ : chr "AdjClose"
## Index: Date[1:994], format: "2012-03-14" "2012-03-15" "2012-03-16" "2012-03-19" ...
## 'zoo' series from 2012-03-14 to 2015-09-30
## Data: num [1:924] 2.21 2.21 2.21 2.21 2.21 ...
## Index: Date[1:924], format: "2012-03-14" "2012-03-15" "2012-03-16" "2012-03-19" ...
## Warning in adf.test(d.series.name): p-value smaller than printed p-value
## Warning in lsfit(log10(M), log10(RS), wt): 29 missing values deleted
##
## Title:
## ARIMA Modelling
##
## Call:
## armaFit(formula = ~arma(1, 3), data = d.series.name)
##
## Model:
## ARIMA(1,0,3) with method: CSS-ML
##
## Coefficient(s):
## ar1 ma1 ma2 ma3 intercept
## 0.426797 -0.560552 0.053052 -0.238926 0.001384
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.391973 -0.011893 -0.001244 0.015092 1.275535
##
## Moments:
## Skewness Kurtosis
## -1.295 120.049
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## ar1 0.426797 0.076118 5.607 2.06e-08 ***
## ma1 -0.560552 0.074747 -7.499 6.42e-14 ***
## ma2 0.053052 0.043406 1.222 0.222
## ma3 -0.238926 0.031674 -7.543 4.57e-14 ***
## intercept 0.001384 0.001440 0.961 0.336
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## sigma^2 estimated as: 0.00969
## log likelihood: 829.97
## AIC Criterion: -1647.94
##
## Description:
## Thu Jan 7 16:12:36 2016 by user:
## Warning in lsfit(log10(M), log10(RS), wt): 29 missing values deleted
##
## Series Initialization:
## ARMA Model: arma
## Formula Mean: ~ arma(1, 1)
## GARCH Model: garch
## Formula Variance: ~ garch(2, 1)
## ARMA Order: 1 1
## Max ARMA Order: 1
## GARCH Order: 2 1
## Max GARCH Order: 2
## Maximum Order: 2
## Conditional Dist: norm
## h.start: 3
## llh.start: 1
## Length of Series: 923
## Recursion Init: mci
## Series Scale: 0.1033657
##
## Parameter Initialization:
## Initial Parameters: $params
## Limits of Transformations: $U, $V
## Which Parameters are Fixed? $includes
## Parameter Matrix:
## U V params includes
## mu -0.13042069 0.1304207 0.01305813 TRUE
## ar1 -0.99999999 1.0000000 -0.52596396 TRUE
## ma1 -0.99999999 1.0000000 0.45626181 TRUE
## omega 0.00000100 100.0000000 0.10000000 TRUE
## alpha1 0.00000001 1.0000000 0.05000000 TRUE
## alpha2 0.00000001 1.0000000 0.05000000 TRUE
## gamma1 -0.99999999 1.0000000 0.10000000 FALSE
## gamma2 -0.99999999 1.0000000 0.10000000 FALSE
## beta1 0.00000001 1.0000000 0.80000000 TRUE
## delta 0.00000000 2.0000000 2.00000000 FALSE
## skew 0.10000000 10.0000000 1.00000000 FALSE
## shape 1.00000000 10.0000000 4.00000000 FALSE
## Index List of Parameters to be Optimized:
## mu ar1 ma1 omega alpha1 alpha2 beta1
## 1 2 3 4 5 6 9
## Persistence: 0.9
##
##
## --- START OF TRACE ---
## Selected Algorithm: nlminb
##
## R coded nlminb Solver:
##
## 0: 967.58942: 0.0130581 -0.525964 0.456262 0.100000 0.0500000 0.0500000 0.800000
## 1: 946.80898: 0.0130581 -0.526246 0.455994 0.0849877 0.0504835 0.0491423 0.790264
## 2: 941.35280: 0.0130579 -0.526773 0.455496 0.0699198 0.0525607 0.0485962 0.780825
## 3: 938.20876: 0.0130572 -0.528770 0.453608 0.0805589 0.0637244 0.0496474 0.772176
## 4: 936.01889: 0.0130559 -0.531357 0.451178 0.0787447 0.0735573 0.0495962 0.757730
## 5: 933.89311: 0.0130500 -0.539192 0.443934 0.0959114 0.0833502 0.0517521 0.729877
## 6: 932.39394: 0.0130443 -0.545643 0.438012 0.0908191 0.107386 0.0757073 0.724335
## 7: 932.25930: 0.0130123 -0.553081 0.431147 0.0989278 0.0933489 0.0750350 0.694113
## 8: 931.78839: 0.0130120 -0.553271 0.430965 0.103134 0.0953226 0.0765080 0.696866
## 9: 931.60029: 0.0130114 -0.553655 0.430599 0.0991742 0.0985884 0.0786114 0.697459
## 10: 931.41811: 0.0129993 -0.556044 0.428190 0.101352 0.104982 0.0720578 0.702428
## 11: 931.25579: 0.0129763 -0.557703 0.426417 0.0985900 0.112384 0.0646962 0.702315
## 12: 931.17804: 0.0128827 -0.548232 0.435006 0.103903 0.124977 0.0654636 0.692311
## 13: 931.01319: 0.0126245 -0.573829 0.409419 0.0999748 0.136144 0.0549268 0.699869
## 14: 931.00259: 0.0126239 -0.573381 0.409825 0.0993139 0.136706 0.0553676 0.699628
## 15: 930.99164: 0.0126203 -0.572839 0.410271 0.0999484 0.137192 0.0554033 0.700031
## 16: 930.97702: 0.0126075 -0.571589 0.411215 0.0991066 0.138019 0.0547034 0.700456
## 17: 930.96119: 0.0125712 -0.569293 0.412759 0.0993224 0.139346 0.0531641 0.702003
## 18: 930.93498: 0.0124562 -0.567325 0.413003 0.0989396 0.138627 0.0551729 0.700851
## 19: 930.90891: 0.0122255 -0.566167 0.411178 0.100877 0.137685 0.0590722 0.697159
## 20: 930.87405: 0.0120102 -0.562354 0.412211 0.0997537 0.142229 0.0528290 0.698606
## 21: 930.85152: 0.0117723 -0.559090 0.414083 0.100088 0.143340 0.0528754 0.700270
## 22: 930.83165: 0.0115337 -0.557912 0.414836 0.0990335 0.141898 0.0561553 0.699591
## 23: 930.75889: 0.00971934 -0.551668 0.409794 0.0988277 0.151849 0.0433092 0.699115
## 24: 930.27939: -0.00114068 -0.516561 0.379595 0.103142 0.163531 0.0522702 0.688221
## 25: 930.01328: -0.0119426 -0.435956 0.322737 0.100179 0.166044 0.0446284 0.698160
## 26: 929.73136: -0.0226798 -0.354896 0.216785 0.101193 0.156178 0.0578991 0.694307
## 27: 929.60081: -0.0299643 -0.410601 0.275530 0.102152 0.132696 0.0777366 0.690777
## 28: 929.55580: -0.0329053 -0.477743 0.335559 0.101214 0.132565 0.0781253 0.692050
## 29: 929.55554: -0.0348876 -0.436081 0.284208 0.100764 0.130674 0.0805701 0.692226
## 30: 929.55057: -0.0341590 -0.465515 0.317678 0.100888 0.131164 0.0797313 0.692133
## 31: 929.55056: -0.0341556 -0.464813 0.317285 0.100891 0.131355 0.0795513 0.692152
## 32: 929.55055: -0.0341711 -0.465080 0.317505 0.100891 0.131290 0.0795890 0.692155
## 33: 929.55055: -0.0341724 -0.465094 0.317513 0.100890 0.131296 0.0795832 0.692155
##
## Final Estimate of the Negative LLH:
## LLH: -1165.182 norm LLH: -1.262385
## mu ar1 ma1 omega alpha1
## -0.003532254 -0.465093595 0.317512574 0.001077959 0.131295992
## alpha2 beta1
## 0.079583204 0.692155043
##
## R-optimhess Difference Approximated Hessian Matrix:
## mu ar1 ma1 omega alpha1
## mu -128480.59912 197.32587 -99.984334 6.906563e+05 -575.83877
## ar1 197.32587 -217.76756 -201.662115 6.182968e+03 55.48211
## ma1 -99.98433 -201.66211 -194.416743 1.006964e+04 42.66468
## omega 690656.27134 6182.96839 10069.639030 -3.158162e+08 -97893.80662
## alpha1 -575.83877 55.48211 42.664676 -9.789381e+04 -1099.55414
## alpha2 -2774.72114 14.70127 -7.695865 -8.393257e+04 -1090.21732
## beta1 -228.62597 88.37801 88.268715 -1.154244e+06 -1584.54527
## alpha2 beta1
## mu -2774.721135 -2.286260e+02
## ar1 14.701266 8.837801e+01
## ma1 -7.695865 8.826871e+01
## omega -83932.570964 -1.154244e+06
## alpha1 -1090.217315 -1.584545e+03
## alpha2 -1560.334134 -2.090775e+03
## beta1 -2090.775041 -7.710301e+03
## attr(,"time")
## Time difference of 0.05019403 secs
##
## --- END OF TRACE ---
##
##
## Time to Estimate Parameters:
## Time difference of 0.14305 secs
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(2, 1), data = d.series.name,
## include.mean = TRUE)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(2, 1)
## <environment: 0x7fd1b57e64e0>
## [data = d.series.name]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1 alpha2
## -0.0035323 -0.4650936 0.3175126 0.0010780 0.1312960 0.0795832
## beta1
## 0.6921550
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu -0.0035323 0.0030173 -1.171 0.2417
## ar1 -0.4650936 0.3648070 -1.275 0.2023
## ma1 0.3175126 0.3879403 0.818 0.4131
## omega 0.0010780 0.0001064 10.134 <2e-16 ***
## alpha1 0.1312960 0.0569969 2.304 0.0212 *
## alpha2 0.0795832 0.0594417 1.339 0.1806
## beta1 0.6921550 0.0270258 25.611 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 1165.182 normalized: 1.262385
##
## Description:
## Thu Jan 7 16:12:37 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 3935116 0
## Shapiro-Wilk Test R W 0.3097579 0
## Ljung-Box Test R Q(10) 27.76416 0.001968995
## Ljung-Box Test R Q(15) 39.54696 0.0005306483
## Ljung-Box Test R Q(20) 40.11346 0.004832976
## Ljung-Box Test R^2 Q(10) 5.702808 0.8395835
## Ljung-Box Test R^2 Q(15) 6.09349 0.9781342
## Ljung-Box Test R^2 Q(20) 6.132036 0.9987071
## LM Arch Test R TR^2 5.873323 0.9223325
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -2.509603 -2.472990 -2.509717 -2.495634
# VALE5.SA
stock.name <- "VALE5.SA"
stock.description <- "Vale S.A."
# Call your function and pass x and y to the function
run <- generateAnalysis(stock.name,stock.description)
## time series starts 2003-01-01
## 'zoo' series from 2003-01-01 to 2016-01-06
## Data: num [1:3228, 1] 6.07 6.07 6 5.84 5.71 ...
## - attr(*, "dimnames")=List of 2
## ..$ : NULL
## ..$ : chr "AdjClose"
## Index: Date[1:3228], format: "2003-01-01" "2003-01-02" "2003-01-03" "2003-01-06" ...
## 'zoo' series from 2003-01-01 to 2015-09-30
## Data: num [1:3158] 6.07 6.07 6 5.84 5.71 ...
## Index: Date[1:3158], format: "2003-01-01" "2003-01-02" "2003-01-03" "2003-01-06" ...
## Warning in adf.test(d.series.name): p-value smaller than printed p-value
##
## Title:
## ARIMA Modelling
##
## Call:
## armaFit(formula = ~arma(1, 3), data = d.series.name)
##
## Model:
## ARIMA(1,0,3) with method: CSS-ML
##
## Coefficient(s):
## ar1 ma1 ma2 ma3 intercept
## -0.1147017 0.1352835 -0.0466870 -0.0628895 0.0002432
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.1591899 -0.0125681 0.0002449 0.0123261 0.1234791
##
## Moments:
## Skewness Kurtosis
## -0.0741 3.2827
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## ar1 -0.1147017 0.2806508 -0.409 0.68276
## ma1 0.1352835 0.2799768 0.483 0.62896
## ma2 -0.0466870 0.0185914 -2.511 0.01203 *
## ma3 -0.0628895 0.0207959 -3.024 0.00249 **
## intercept 0.0002432 0.0003799 0.640 0.52203
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## sigma^2 estimated as: 0.0005368
## log likelihood: 7406.32
## AIC Criterion: -14800.64
##
## Description:
## Thu Jan 7 16:12:40 2016 by user:
##
## Series Initialization:
## ARMA Model: arma
## Formula Mean: ~ arma(1, 1)
## GARCH Model: garch
## Formula Variance: ~ garch(2, 1)
## ARMA Order: 1 1
## Max ARMA Order: 1
## GARCH Order: 2 1
## Max GARCH Order: 2
## Maximum Order: 2
## Conditional Dist: norm
## h.start: 3
## llh.start: 1
## Length of Series: 3157
## Recursion Init: mci
## Series Scale: 0.02324454
##
## Parameter Initialization:
## Initial Parameters: $params
## Limits of Transformations: $U, $V
## Which Parameters are Fixed? $includes
## Parameter Matrix:
## U V params includes
## mu -0.10373679 0.1037368 0.01037722 TRUE
## ar1 -0.99999999 1.0000000 -0.29796748 TRUE
## ma1 -0.99999999 1.0000000 0.32712119 TRUE
## omega 0.00000100 100.0000000 0.10000000 TRUE
## alpha1 0.00000001 1.0000000 0.05000000 TRUE
## alpha2 0.00000001 1.0000000 0.05000000 TRUE
## gamma1 -0.99999999 1.0000000 0.10000000 FALSE
## gamma2 -0.99999999 1.0000000 0.10000000 FALSE
## beta1 0.00000001 1.0000000 0.80000000 TRUE
## delta 0.00000000 2.0000000 2.00000000 FALSE
## skew 0.10000000 10.0000000 1.00000000 FALSE
## shape 1.00000000 10.0000000 4.00000000 FALSE
## Index List of Parameters to be Optimized:
## mu ar1 ma1 omega alpha1 alpha2 beta1
## 1 2 3 4 5 6 9
## Persistence: 0.9
##
##
## --- START OF TRACE ---
## Selected Algorithm: nlminb
##
## R coded nlminb Solver:
##
## 0: 4220.5083: 0.0103772 -0.297967 0.327121 0.100000 0.0500000 0.0500000 0.800000
## 1: 4216.4468: 0.0103774 -0.296902 0.328160 0.0816230 0.0481218 0.0498433 0.791563
## 2: 4202.4737: 0.0103776 -0.295404 0.329616 0.0777685 0.0600405 0.0645020 0.797769
## 3: 4198.9154: 0.0103780 -0.292750 0.332172 0.0587052 0.0616100 0.0704353 0.797734
## 4: 4194.2747: 0.0103790 -0.287891 0.336765 0.0546845 0.0600077 0.0768558 0.815341
## 5: 4190.1470: 0.0103804 -0.284722 0.339464 0.0456379 0.0492084 0.0747525 0.829284
## 6: 4182.8614: 0.0103854 -0.293368 0.328157 0.0237297 0.0227754 0.0634317 0.889690
## 7: 4182.8353: 0.0103855 -0.293172 0.328344 0.0242027 0.0229698 0.0634197 0.890115
## 8: 4182.7486: 0.0103855 -0.292912 0.328582 0.0238916 0.0227839 0.0629200 0.890215
## 9: 4182.6518: 0.0103857 -0.292277 0.329168 0.0241073 0.0229477 0.0622721 0.891122
## 10: 4182.4173: 0.0103860 -0.291210 0.330102 0.0232492 0.0231238 0.0604766 0.892623
## 11: 4181.8799: 0.0103880 -0.288251 0.332266 0.0205962 0.0275671 0.0531453 0.899710
## 12: 4181.7725: 0.0103902 -0.287643 0.331915 0.0206318 0.0271576 0.0478972 0.902241
## 13: 4181.6885: 0.0103916 -0.287509 0.331421 0.0214289 0.0281363 0.0463689 0.904001
## 14: 4181.5292: 0.0103931 -0.288049 0.330189 0.0206087 0.0297673 0.0449076 0.903903
## 15: 4181.5001: 0.0103932 -0.287721 0.330471 0.0201571 0.0303208 0.0450884 0.904273
## 16: 4181.4903: 0.0103942 -0.287342 0.330390 0.0197856 0.0303187 0.0443849 0.904545
## 17: 4181.4478: 0.0103953 -0.287039 0.330247 0.0198494 0.0306317 0.0438646 0.905156
## 18: 4181.3822: 0.0104005 -0.285592 0.329373 0.0192441 0.0316866 0.0409189 0.907264
## 19: 4181.3710: 0.0104263 -0.279882 0.323830 0.0193311 0.0323208 0.0402627 0.908013
## 20: 4181.3098: 0.0104526 -0.273730 0.318727 0.0190792 0.0318363 0.0407459 0.907759
## 21: 4181.2973: 0.0104687 -0.271159 0.314781 0.0187759 0.0339347 0.0392624 0.907976
## 22: 4181.2557: 0.0105059 -0.262338 0.309281 0.0185062 0.0324165 0.0406556 0.907948
## 23: 4181.1332: 0.0107154 -0.225419 0.269950 0.0185378 0.0351948 0.0352990 0.909883
## 24: 4181.1144: 0.0107154 -0.225398 0.269969 0.0186356 0.0353079 0.0354033 0.909986
## 25: 4181.1067: 0.0107155 -0.225321 0.270037 0.0184745 0.0353859 0.0354492 0.909975
## 26: 4181.1030: 0.0107170 -0.225004 0.269834 0.0184924 0.0354696 0.0355134 0.910044
## 27: 4181.0977: 0.0107201 -0.224394 0.269340 0.0184091 0.0354496 0.0354811 0.910031
## 28: 4181.0908: 0.0107263 -0.223166 0.268353 0.0183983 0.0355081 0.0355120 0.910119
## 29: 4180.9833: 0.0109980 -0.172220 0.223144 0.0180002 0.0344977 0.0344766 0.912143
## 30: 4180.9145: 0.0114051 -0.128679 0.179729 0.0186784 0.0347649 0.0367378 0.909781
## 31: 4180.8614: 0.0120147 -0.0981896 0.148996 0.0186760 0.0350652 0.0374611 0.907772
## 32: 4180.6286: 0.0167261 -0.146222 0.195989 0.0160406 0.0423852 0.0262607 0.914594
## 33: 4179.9863: 0.0278852 -0.108362 0.160499 0.0179731 0.0452981 0.0268463 0.909684
## 34: 4179.8759: 0.0389712 -0.201948 0.254826 0.0190505 0.0349392 0.0366266 0.908425
## 35: 4179.7971: 0.0401254 -0.153606 0.203991 0.0186412 0.0361799 0.0364379 0.908242
## 36: 4179.7723: 0.0387613 -0.153286 0.204185 0.0186518 0.0387350 0.0342847 0.907902
## 37: 4179.7712: 0.0380231 -0.145066 0.196369 0.0185615 0.0395751 0.0330278 0.908373
## 38: 4179.7707: 0.0379510 -0.149362 0.200467 0.0185766 0.0395148 0.0333839 0.908112
## 39: 4179.7706: 0.0380834 -0.148776 0.199910 0.0185871 0.0394370 0.0334200 0.908129
## 40: 4179.7706: 0.0380611 -0.148700 0.199835 0.0185843 0.0394510 0.0334001 0.908138
## 41: 4179.7706: 0.0380622 -0.148710 0.199845 0.0185846 0.0394502 0.0334020 0.908137
##
## Final Estimate of the Negative LLH:
## LLH: -7695.869 norm LLH: -2.437716
## mu ar1 ma1 omega alpha1
## 8.847391e-04 -1.487097e-01 1.998448e-01 1.004141e-05 3.945024e-02
## alpha2 beta1
## 3.340199e-02 9.081366e-01
##
## R-optimhess Difference Approximated Hessian Matrix:
## mu ar1 ma1 omega
## mu -5804399.013 -3.054037e+03 1.286124e+03 -5.248985e+07
## ar1 -3054.037 -3.052770e+03 -3.071717e+03 -1.265958e+06
## ma1 1286.124 -3.071717e+03 -3.117684e+03 -1.186777e+06
## omega -52489849.142 -1.265958e+06 -1.186777e+06 -1.454973e+12
## alpha1 1319.787 6.021266e+01 5.899689e+01 -3.943726e+08
## alpha2 -7751.153 -3.789274e+01 -3.491994e+01 -3.932371e+08
## beta1 -28331.208 -5.595683e+02 -5.343574e+02 -5.055202e+08
## alpha1 alpha2 beta1
## mu 1.319787e+03 -7.751153e+03 -2.833121e+04
## ar1 6.021266e+01 -3.789274e+01 -5.595683e+02
## ma1 5.899689e+01 -3.491994e+01 -5.343574e+02
## omega -3.943726e+08 -3.932371e+08 -5.055202e+08
## alpha1 -1.605027e+05 -1.591281e+05 -1.736106e+05
## alpha2 -1.591281e+05 -1.612429e+05 -1.754598e+05
## beta1 -1.736106e+05 -1.754598e+05 -2.079402e+05
## attr(,"time")
## Time difference of 0.1205029 secs
##
## --- END OF TRACE ---
##
##
## Time to Estimate Parameters:
## Time difference of 0.4151878 secs
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~arma(1, 1) + garch(2, 1), data = d.series.name,
## include.mean = TRUE)
##
## Mean and Variance Equation:
## data ~ arma(1, 1) + garch(2, 1)
## <environment: 0x7fd1b9ab7d78>
## [data = d.series.name]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu ar1 ma1 omega alpha1
## 8.8474e-04 -1.4871e-01 1.9984e-01 1.0041e-05 3.9450e-02
## alpha2 beta1
## 3.3402e-02 9.0814e-01
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 8.847e-04 4.451e-04 1.988 0.046835 *
## ar1 -1.487e-01 2.080e-01 -0.715 0.474662
## ma1 1.998e-01 2.058e-01 0.971 0.331439
## omega 1.004e-05 2.712e-06 3.702 0.000214 ***
## alpha1 3.945e-02 1.738e-02 2.270 0.023202 *
## alpha2 3.340e-02 2.103e-02 1.588 0.112285
## beta1 9.081e-01 1.456e-02 62.383 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## 7695.869 normalized: 2.437716
##
## Description:
## Thu Jan 7 16:12:41 2016 by user:
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 158.6731 0
## Shapiro-Wilk Test R W 0.9921676 4.212096e-12
## Ljung-Box Test R Q(10) 12.27084 0.2673392
## Ljung-Box Test R Q(15) 24.79349 0.05278648
## Ljung-Box Test R Q(20) 27.02037 0.1346918
## Ljung-Box Test R^2 Q(10) 11.04974 0.3536558
## Ljung-Box Test R^2 Q(15) 14.87996 0.4600981
## Ljung-Box Test R^2 Q(20) 16.74909 0.6692009
## LM Arch Test R TR^2 12.86545 0.3788956
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## -4.870997 -4.857566 -4.871007 -4.866178